package com.BEASTMODE.games.SpeedPong;

import java.util.List;
import com.BEASTMODE.libs.BaseState;
import android.view.MotionEvent;
import com.BEASTMODE.libs.Network.Network;

public class GameState extends BaseState
{
	private static BaseState _state_instance = null;
	
	
	private GameState()
	{
		super();
	}
	
	@Override
	public void Enter()
	{
		Network.Initialize();
		Network.Connect("97.102.53.251", 5891);
	}
	
	public static BaseState GetInstance()
	{
		if (_state_instance == null)
			_state_instance = new GameState();
		return _state_instance;
	}
	
	
	@Override
	public void Exit()
	{
		if (Network.Connected())
		{
			Network.Disconnect();
		}
	}
	
	
	@Override
	public boolean Update(float fDeltaTime)
	{
		if (HandleInput() == false)
		{		
		return false;
		}
		else
		{
		
		}
		return true;
	}
	
 
	@Override
	public void AddInput(MotionEvent event)
	{
		_input_list.add(event);
	}

	@Override
	public boolean HandleInput()
	{
		for(MotionEvent event : _input_list )
		{
			
			//Test for what input you want to handle
			if(event.getAction() == MotionEvent.ACTION_POINTER_1_UP)
			{
				//lifting first detected touch up 	
			}
			
		}
		
		_input_list.clear();
		return true;
	}
}
